<!DOCTYPE html>
<html>
<head lang="en">
	<meta charset="UTF-8">
	<title>登录</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport"
		  content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="format-detection" content="telephone=no">
	<meta name="renderer" content="webkit">
	<meta http-equiv="Cache-Control" content="no-siteapp"/>
	<script src="/static/home/js/jquery-1.11.3.min.js"></script>

	<link rel="stylesheet" href="/static/home/AmazeUI-2.4.2/assets/css/amazeui.css"/>
	<link href="/static/home/css/dlstyle.css" rel="stylesheet" type="text/css">
</head>

<body>

<div class="login-boxtitle">
	<a href="/index/index/index"><img alt="logo" src="/static/home/images/logobig.png"/></a>
</div>

<div class="login-banner">
	<div class="login-main">
		<div class="login-banner-bg"><span></span><img src="/static/home/images/big.jpg"/></div>
		<div class="login-box">

			<h3 class="title">登录商城</h3>

			<div class="clear"></div>

			<div class="login-form">
				<form>
					<div class="user-name">
						<label for="user"><i class="am-icon-user"></i></label>
						<input type="text" name="" id="user" placeholder="邮箱/手机/用户名" {if isset($autodata)}value = {$autodata['username']} {/if} >
					</div>
					<div>
						<span id="userTip"></span>
					</div>
					<div class="user-pass">
						<label for="password"><i class="am-icon-lock"></i></label>
						<input type="password" name="" id="password" placeholder="请输入密码"
						{if isset($autodata)}
							   value = {$autodata['password']}
							   {/if}
						>
					</div>
				</form>
			</div>

			<div class="login-links">
				<label for="remember-me"><input id="remember-me" type="checkbox">记住密码</label>
				<a href="#" class="am-fr">忘记密码</a>
				<a href="/index/user/register" class="zcnext am-fr am-btn-default">注册</a>
				<br/>
			</div>
			<div class="am-cf">
				<input type="submit" name="" value="登 录" class="am-btn am-btn-primary am-btn-sm" id="loginSubmit">
			</div>
			<div class="partner">
				<h3>合作账号</h3>
				<!--<div class="am-btn-group">-->

					<!--<li><a href="{$url}"><i class="am-icon-weibo am-icon-sm"></i><span>微博登录</span> </a></li>-->

					<li><a href="{$url}"><i class=""><img src="/static/images/weibo_login.png"></i></a></li>

				<!--</div>-->
			</div>

		</div>
	</div>
</div>

<div class="footer ">
	<div class="footer-hd ">
		<p>
			<a href="# ">创科科技</a>
			<b>|</b>
			<a href="/index/index/index">商城首页</a>
			<b>|</b>
			<a href="# ">支付宝</a>
			<b>|</b>
			<a href="# ">物流</a>
		</p>
	</div>
	<div class="footer-bd ">
		<p>
			<a href="# ">关于恒望</a>
			<a href="# ">合作伙伴</a>
			<a href="# ">联系我们</a>
			<a href="# ">网站地图</a>
			<em>© 2015-2025 Hengwang.com 版权所有.</em>
		</p>
	</div>
</div>
</body>
<script>
	$(function () {
		//登录--------------------------------------------------------------------------
		var usernameFlag = false;	//用户名标记	true用户存在

		var user = $('#user');	//用户名对象
		var username = null;	//用户名
		var useType = null;		//用户名类型 1表示号码, 2邮箱, 2用户名
		var userTip = $('#userTip');	//用户名提示
		var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;	//邮箱正则
		user.blur(function () {
			username = user.val();
			if (parseInt(username) == username) {
				useType = 1;
				$.post('phoneCheck', {phone: username}, success, 'json')
			} else if (username.match(reg)) {
				useType = 2;
				$.post('emailCheck', {email: username}, success, 'json');
			} else {
				useType = 3;
				$.post('nameCheck', {username: username}, success, 'json');

			}
		});

		//验证密码
		var passwordFlag = false;	//密码标记位

		var pwd = null;	//保存输入的密码
		$('#password').blur(function () {
			pwd = $('#password').val();
			passwordFlag = true;
		});

		//是否记住密码
		var isRem = false;	//是否记住密码, true记住
		$('#remember-me').click(function () {
			if ($('#remember-me').is(':checked')) {
				isRem = true;
			} else {
				isRem = false;
			}
		});

		//提交登录信息
		$('#loginSubmit').click(function () {
			if (usernameFlag || passwordFlag) {
                usernameFlag = false;
                $.post('loginCheck', {name: username, useType: useType, pwd: pwd, rem: isRem}, success, 'json');
            } else {
				alert('请检查输入信息');
			}
		});

		function success(obj) {
			switch (obj.state) {
				case 0:
					userTip.text('邮箱不存在, 请注册').css('color', 'red');
					usernameFlag = false;
					break;
				case 1:
					userTip.text('邮箱正确').css('color', 'blue');
					usernameFlag = true;
					break;
				case 3:
					userTip.text('手机号正确').css('color', 'blue');
					usernameFlag = true;
					break;
				case 4:
					userTip.text('手机号不存在, 请注册').css('color', 'red');
					usernameFlag = false;
					break;
				case 5:
					userTip.text('用户名正确').css('color', 'blue');
					usernameFlag = true;
					break;
				case 6:
					userTip.text('用户名不存在, 请注册').css('color', 'red');
					usernameFlag = false;
					break;
				case 7:
					alert('登录成功');
					usernameFlag = false;
					window.location.href = '/index/index/index';
					break;
				case 8:
					alert('登录失败, 请重试');
					usernameFlag = false;
					break;
			}
		}
	});
</script>
</html>